/******************** 
	作用:资金统计
	作者:蔡俊雄
	版本:V1.0
	时间:2015-08-14
********************/

$(function() {
	var tableId = "#dynamic-table"; //表格ID
	//	var withdrawUrl = ""; //累计提现的地址(这里不用修改,直接获取链接href里的地址)
	//	var bonusUrl = ""; //累计佣金的网址(这里不用修改,直接获取链接href里的地址)
	//	var collectionUrl = ""; //代收款的网址(这里不用修改,直接获取链接href里的地址)
	//	var refundUrl = ""; //商城退款的网址(这里不用修改,直接获取链接href里的地址)
	//	var unfreezeUrl = ""; //取消冻结帐户的网址(这里不用修改,直接获取链接href里的地址)
	//	var freezeUrl = ""; //冻结帐户的网址(这里不用修改,直接获取链接href里的地址)
	//	var rechargeUrl = ""; //充值的网址(这里不用修改,直接获取链接href里的地址)

	var commonUrl = ""; //通用url地址
	var commonType = null; //操作类型
	var opearationConfig = {
		"withdraw": {
			"title": "提现记录"
		},
		"bonus": {
			"title": "佣金记录"
		},
		"collection": {
			"title": "代收款记录"
		},
		"refund": {
			"title": "退款记录"
		},
		"unfreeze": {
			"title": "取消冻结帐户"
		},
		"freeze": {
			"title": "冻结帐户"
		},
		"recharge": {
			"title": "充值"
		}
	};
	var defaultCloseData = ["withdraw", "bonus", "collection", "refund"]; //使用默认弹出框的类型

	General.extendDialog(); //扩展对话框

	//-----------------点击相应的链接弹出不同的对话框-----------------
	//点击行内链接按钮
	$(tableId + ">tbody a[data-id]:not([disabled])").on("click", function(e) {
		General.stopEvent(e);
		commonUrl = $(this).attr("href");
		commonType = $(this).attr("data-id"); //操作类型
		showDialog();
	});

	//显示弹出窗口
	function showDialog() {
		var url = commonUrl;
		var title = opearationConfig[commonType].title;
		if (defaultCloseData.indexOf(commonType) != -1) {
			General.showDialogWidthHeightClose(title, url, "90%", 200);
		} else {
			General.isAdjustDialogHeight = false;
			if (commonType == "recharge") {
				General.showDialogWidthHeight(title, url, 600, 458);
			} else if (commonType == "freeze") {
				General.showDialogWidthHeight(title, url, 600, 336);
			} else if (commonType == "unfreeze") {
				General.showDialogWidthHeight(title, url, 600, 336);
			}
			//			General.showDialogWidthHeight(title,url,"90%",0);
		}


		//		General.showDialogWidthHeight(title,url,600,400);
	}
});